import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;


public class ServerChat {
	 private ServerSocket accepter;

	    public ServerChat (int port, int backlog, InetAddress bindAddr) throws IOException {
	    	accepter = new ServerSocket(port,0, bindAddr);
	    	System.out.println("Server IP address: " + accepter.getInetAddress());
	    }

	    public void listen() throws IOException {
		for (;;) {
		    Socket s = accepter.accept();
		    ServerChatThread echoer = new ServerChatThread(s);
		    System.out.println("Connection accepted from " + s.getInetAddress());
		    echoer.start();
		}
	    }

	    public static void main(String[] args) throws IOException {
	    	ServerChat s = new ServerChat(8888,0, InetAddress.getByName("bill.cs.hendrix.edu") );
	    	s.listen();
	    	System.out.println("good");
	    }
}
